<template>
   <div>
   姓 <input type="text" v-model="firstName"/>
   名  <input type="text" v-model="lastName"/>

   姓名： <input type="text" v-model="name"/>
   </div>
</template>
<script lang = "ts">
import { defineComponent ,ref ,computed} from 'vue'
export default defineComponent({
  name: 'computed',
  setup(){
      const firstName = ref<string>('')
      const lastName = ref<string>('')
      const name =    computed({
         get:()=>{
            return firstName.value   +  lastName.value
         } ,
         set:()=>{
            console.log(name,'set函数执行了')
         }
      })
      


    return {
         firstName,
         lastName,
         name
      }   
  }
  

})
</script>

